home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / sos3-2.lha / src / cfe / cfe_main.c < prev    next >
C/C++ Source or Header  |  1992-01-23  |  2KB  |  66 lines

  1. /* --------------------------------------------------------------------------
  2.  * Copyright 1992 by Forschungszentrum Informatik (FZI)
  3.  *
  4.  * You can use and distribute this software under the terms of the licence
  5.  * you should have received along with this program.
  6.  * If not or if you want additional information, write to
  7.  * Forschungszentrum Informatik, "STONE", Haid-und-Neu-Strasse 10-14,
  8.  * D-7500 Karlsruhe 1, Germany.
  9.  * --------------------------------------------------------------------------
  10.  */
  11. // **************************************************************************
  12. // Module cfe_main                                           Juergen Uhl (ju)
  13. //
  14. // **************************************************************************
  15.  
  16. #include <stdio.h>
  17. #include <osfcn.h>
  18. #include "sys.h"
  19. #include "sos.h"
  20. #include "cfe_err.h"
  21. #include "trc_cfe.h"
  22. #include "mta_use.h"
  23.  
  24. #include "cfe_yacc.h"
  25. #include "cfe.h"
  26.  
  27. #ifdef PROFILE
  28. extern "C" void monitor(...);
  29. #endif
  30.  
  31. int main (int argc, char *argv[])
  32. {  int status = 0;
  33.  
  34.    T_INIT ("cfe.out");
  35.    sos_init (argc, argv);
  36.  
  37.    if (argc == 3 AND streql (argv[1], "-E"))
  38.       cfe_echo_flag = 1;
  39.    else if (argc != 2)
  40.    {  err_raise (err_USE, err_CFE_USAGE, NULL, FALSE);
  41.       status = 1;
  42.    }
  43.  
  44.    if (status EQ 0)
  45.    {  
  46.       yyin = fopen (argv[argc-1], "r");
  47.       if (yyin == 0)
  48.       {  err_raise (err_USE, err_CFE_NO_FILE, argv[argc-1], FALSE);
  49.      status = 1;
  50.       }
  51.       else
  52.       {  cfe_compile ();
  53.  
  54.      if (err_occurred (err_SYS) + err_occurred (err_USE) != 0)
  55.         status = -1;
  56.       }
  57.    }
  58.  
  59. #ifdef PROFILE
  60.    monitor (0);
  61. #endif
  62.  
  63.    T_EXIT ();
  64.    exit (status);
  65. }
  66.